﻿@{
    ViewBag.Title = "RechargeAccount";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>       
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" id="refresh" iconCls="icon-search" onclick="search" plain="true">刷新</a>
                <span class="separator"></span>
                <a class="mini-button" id="export" iconCls="icon-node" onclick="setExportExcel('datagrid1')"plain="true">导出</a>
                <a class="mini-button" id="print" iconCls="icon-print" onclick="printdata" plain="true">打印</a>
                <span class="separator"></span>
                <a class="mini-button" id="close" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
            </td>
        </tr>
    </table>                
</div>
<form id="form1">
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">充值日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">&nbsp;&nbsp;服务商：</td>
                <td width ="190px"> @Html.Partial("~/Views/Modular/LookupCorpClassInfo.cshtml")      
                </td>
                <td width ="70px" align="right">交易单号：</td>
                <td width ="90px">
                    &nbsp;<input name="FBillNo" class="mini-textbox" style="width:85px;"/>
                </td>
            </tr>
        </table>
    </div>
</form>
        <div class="mini-fit" >
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                    borderStyle="border:1;" url="GetRechargeAccount"   showSummaryRow="true"
                    allowCellSelect="true" allowCellEdit="true"showColumnsMenu="true"fitColumns="false"   ondrawsummarycell="onDrawSummaryCell"
                    onrowdblclick="modify"  sortMode="client" >
                <div property="columns">
                    <div type="checkcolumn" >选行</div>
                    <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                    <div field="FDate" name="FDate" width="80" headeralign="center" allowsort="true">日期</div>
                    <div field="mark" name="mark" width="120" headeralign="center" allowsort="true">摘要</div>
                    <div field="FBillNo" name="FBillNo" width="100" headeralign="center" allowsort="true">交易单号</div>
                    <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true">服务商编码</div>
                    <div field="FName" name="FName" width="120" headeralign="center" allowsort="true">服务商名称</div>
                    <div field="FAmountIn" name="FAmountIn" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">收入金额</div>
                    <div field="FAmountOut" name="FAmountOut" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">支出金额</div>
                    <div field="FAmount" name="FAmount" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">余额</div>
                    <div field="FPayName" name="FPayName" width="80" headeralign="center" allowsort="true">付款方式</div>
                </div>
            </div>
        </div>

<input type="hidden" id="type" value="@ViewBag.type" />

<script>
    var sumFields = "FAmountIn,FAmountOut";
    mini.parse();

    //通用shown自动调用些方式
    function FormShown() {
        var toDay = new Date();
        mini.getbyName("FDate1").setValue(toDay);
        mini.getbyName("FDate2").setValue(toDay);
    }

    $(function () {
        LoadListData();
    });


    //加载资料列表
    function LoadListData() {
        var form = new mini.Form("#form1");
        form.validate();
        var data = form.getData(true, false);
        var formjson = mini.encode(data);
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + "'mSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'search':'" + formjson + "','type':'" + $("#type").val() + "'}]";
        var grid = mini.get("datagrid1");//==
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;//导出
    }

    //搜索资料列表
    function search() {
        LoadListData();
    }

    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, "服务商充值明细表");
            }
        });
    }

</script>